package com.logistics.material.entity.model;

import com.logistics.erp.entity.domain.ErpInvReq;
import com.logistics.material.entity.domain.MaterialBack;
import lombok.Data;

import java.math.BigDecimal;

@Data
public class MaterialBackRow {

    private String pickId;

    private String station;

    private String erpInvBillCode;

    private String container;

    private String itemCode;

    private String itemName;

    private String wcName;

    private String wcCode;

    private String itemWorkCode;

    private String itemUnit;

    private BigDecimal itemQty;

    private String seqNo;

    public MaterialBackRow(){}

    public MaterialBackRow(MaterialBack materialBack){
        this.pickId = materialBack.getPickId();
        this.station = materialBack.getStation();
        this.erpInvBillCode = materialBack.getErpInvBillCode();
        this.container = materialBack.getContainer();
        this.itemCode = materialBack.getItemCode();
        this.itemName = materialBack.getItemName();
        this.wcName = materialBack.getWcName();
        this.wcCode = materialBack.getWcCode();
        this.itemWorkCode = materialBack.getItemWorkCode();
        this.itemUnit = materialBack.getItemUnit();
        this.itemQty = materialBack.getItemQty();
    }

    public MaterialBackRow(ErpInvReq erpInvReq){
        this.itemCode = erpInvReq.getItemCode();
        this.itemName = erpInvReq.getItemName();
        this.seqNo = erpInvReq.getSeqNo();
        this.itemUnit = erpInvReq.getStockUnitName();
        this.itemQty = erpInvReq.getReqQty();
        this.itemWorkCode = erpInvReq.getTaskCode();
    }

    public static MaterialBackRow build(MaterialBack materialBack){
        return new MaterialBackRow(materialBack);
    }

    public static MaterialBackRow build(ErpInvReq erpInvReq){
        return new MaterialBackRow(erpInvReq);
    }
}
